/* eslint-disable */
import React from 'react';
import styles from './workStation.less'
import PropTypes from 'prop-types';
import SwipeableViews from 'react-swipeable-views';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';

import Accordion from '@material-ui/core/Accordion';
import AccordionSummary from '@material-ui/core/AccordionSummary';
import AccordionDetails from '@material-ui/core/AccordionDetails';
// import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';

import Paper from '@material-ui/core/Paper';
import InputBase from '@material-ui/core/InputBase';
import Divider from '@material-ui/core/Divider';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import SearchIcon from '@material-ui/icons/Search';
import DirectionsIcon from '@material-ui/icons/Directions';

import Grid from './components/common/Grid';

let accordionInfo = [
  {
    type: 'finished',
    title: '诸暨新民路建筑垃圾违规倾倒预警',
    riskLevel: '紧急',
    riskLevel2: '违规倾倒预警',
    publishDate: '2020/04/05 12:12'
  },
  {
    type: 'resolving',
    title: '浙D23567 车辆超速预警',
    riskLevel: '普通',
    riskLevel2: '车辆超速预警',
    publishDate: '2020/04/05 12:12'
  },
  {
    type: 'pending',
    title: '浙D23567 车辆超速预警',
    riskLevel: '普通',
    riskLevel2: '车辆超速预警',
    publishDate: '2020/04/05 12:12'
  },
  {
    type: 'pending',
    title: '诸暨新民路建筑垃圾违规倾倒预警',
    riskLevel: '紧急',
    riskLevel2: '违规倾倒预警',
    publishDate: '2020/04/05 12:12'
  }
]

let colorConfig = {
  finished: "#33C1AD",
  resolving: "#64A8FC",
  pending: "#FD7575"
}

function CustomizedInputBase() {
  const classes = makeStyles((theme) => ({
    root: {
      display: 'flex',
      alignItems: 'center'
    }
  }));

  return (
    <Paper component="form" className={classes.root}>
      <InputBase
        className={classes.input}
        placeholder="输入名称关键字搜索"
        inputProps={{ 'aria-label': 'search' }}
      />
      <IconButton type="submit" className={classes.iconButton} aria-label="search">
        <SearchIcon />
      </IconButton>
    </Paper>
  );
}


function a11yProps(index) {
  return {
    id: `full-width-tab-${index}`,
    'aria-controls': `full-width-tabpanel-${index}`,
  };
}

const tabsStyle = makeStyles((theme) => ({
  root: {
    backgroundColor: theme.palette.background.paper,
    width: '100%'
  },
}));

const accordionStyle = makeStyles((theme) => ({
  root: {
    width: '100%',
  },
  heading: {
    // fontSize: theme.typography.pxToRem(15),
    // fontWeight: theme.typography.fontWeightRegular,
    fontWeight: 800,
    fontSize: '16px',
    paddingLeft: '8px'

  },
}));



function TabPanel(props) {
  const { children, value,index, ...other } = props;

  return (
    <div
      role="tabpanel"
      hidden={value !== index}
      id={`full-width-tabpanel-${index}`}
      aria-labelledby={`full-width-tab-${index}`}
      {...other}
    >
      {value === index && (
        <Box p={2}>
          <Typography>{children}</Typography>
        </Box>
      )}
    </div>
  );
}

TabPanel.propTypes = {
  children: PropTypes.node,
  index: PropTypes.any.isRequired,
  value: PropTypes.any.isRequired,
};

function AccordionCard(props) {
  const accordionClasses = accordionStyle();
  const { type, title,riskLevel, riskLevel2,publishDate, ...other } = props;
  return (
  <div className={accordionClasses.root}>
    <Accordion>
      <AccordionSummary
        expandIcon={<DoubleArrowIcon style={{ color: 'red',transform: 'rotate(90deg)' }}/>}
        aria-controls="panel1a-content"
        id="panel1a-header"
      >
        <Typography className={accordionClasses.heading}>
          啊哈哈哈哈发顺丰顺丰
          <span className={styles.suceessBorder}>已完成</span>
        </Typography>
      </AccordionSummary>
      <AccordionDetails>
        <Typography>
        <div className={styles.bottomCardContent}>
            <div>风险级别<i> - </i><span>紧急</span></div>
            <div>风险级别<i> - </i><span>紧急</span></div>
            <div>派发时间<i> - </i><span>2020-24323842362</span></div>
          </div>
        </Typography>
      </AccordionDetails>
    </Accordion>
  </div>
  )
}

export default function workStation() {
  const classes = tabsStyle();
  const theme = useTheme();
  const [value, setValue] = React.useState(0);
  const [topValue, setTopValue] = React.useState(0);
  const gridObj = [
    {
      data: 262,
      text: '当月累计',
      dataColor: '#209EEB'
    },
    {
      data: 12,
      text: '当日累计',
      dataColor: '#8BA0FD'
    },
    {
      data: 7,
      text: '已处理',
      dataColor: '#23BBA5'
    },
    {
      data: 3,
      text: '处理中',
      dataColor: '#F9A968'
    },
    {
      data: 2,
      text: '待响应',
      dataColor: '#FC742B'
    },
    {
      data: 2,
      text: '已超时',
      dataColor: '#F55454'
    }
  ]

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  const handleChangeIndex = (index) => {
    setValue(index);
  };

  const topTabsChange = (event, newValue) => {
    setTopValue(newValue);
  };

  const topTabsChangeIndex = (index) => {
    setTopValue(index);
  };
  return (
    <div className={styles.main}>
      <div className={classes.root}>
      <AppBar position="static" color="default">
        <Tabs
          value={topValue}
          onChange={topTabsChange}
          indicatorColor="primary"
          textColor="primary"
          variant="fullWidth"
          aria-label="full width tabs example"
        >
          <Tab label="事件大厅" {...a11yProps(0)} />
          <Tab label="我的事项" {...a11yProps(1)} />
        </Tabs>
      </AppBar>
      <SwipeableViews
        axis={theme.direction === 'rtl' ? 'x-reverse' : 'x'}
        index={topValue}
        onChangeIndex={topTabsChangeIndex}
      >
        <TabPanel value={topValue} index={0} dir={theme.direction}>
          <Grid data={gridObj}/>
        </TabPanel>
        <TabPanel value={topValue} index={1} dir={theme.direction}>
          <Grid data={gridObj}/>
        </TabPanel>
      </SwipeableViews>
    </div>
    <div className={styles.middleContent}>
      <CustomizedInputBase />
      <span>筛选</span>
    </div>
      <div className={classes.root}>
        <AppBar position="static" color="default">
        <Tabs
          value={value}
          onChange={handleChange}
          indicatorColor="primary"
          textColor="primary"
          variant="fullWidth"
          aria-label="full width tabs example"
        >
          <Tab label="全部" {...a11yProps(0)} />
          <Tab label="待响应" {...a11yProps(1)} />
          <Tab label="处理中" {...a11yProps(2)} />
          <Tab label="已完成" {...a11yProps(3)} />
          <Tab label="已超时" {...a11yProps(4)} />
        </Tabs>
      </AppBar>
        <SwipeableViews
        axis={theme.direction === 'rtl' ? 'x-reverse' : 'x'}
        index={value}
        onChangeIndex={handleChangeIndex}
      >
        <TabPanel value={value} index={0} dir={theme.direction}>
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
        </TabPanel>
        <TabPanel value={value} index={1} dir={theme.direction}>
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
        </TabPanel>
        <TabPanel value={value} index={2} dir={theme.direction}>
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
        </TabPanel>
        <TabPanel value={value} index={3} dir={theme.direction}>
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
        </TabPanel>
        <TabPanel value={value} index={4} dir={theme.direction}>
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
          <AccordionCard />
        </TabPanel>
      </SwipeableViews>
      </div>

    </div>

  );
}



// export default class workStation extends React.Component {
//   render() {
//     return (
//       <div >
//        he
//       </div>
//     );
//   }
// }


